package com.sloan.community.common.command;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import java.util.List;

@ToString
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ArticleCommand {

    @Length(min = 5, max = 100, message = "标题不能超过100字符,不能小于5字符")
    @NotBlank(message = "标题不能为空")
    private String title;

    @Length(min = 10, max = 50000, message = "正文长度在10~50000字之间")
    @NotBlank(message = "正文不能为空")
    private String content;

    private String firstPicture;

    @NotNull(message = "参数错误")
    private Boolean commentable = Boolean.TRUE;

    @NotNull(message = "参数错误")
    private Boolean recommend = Boolean.FALSE;

    @NotNull(message = "参数错误")
    private Boolean appreciation = Boolean.TRUE;

    @NotNull(message = "参数错误")
    private Boolean shareable = Boolean.TRUE;

    @NotEmpty(message = "文章标签不能为空")
    @Size(min = 1, max = 5, message = "文章标签不能超过5个,必须大于1个")
    private List<Long> tagIds;

}
